#pragma once

#ifdef __QT5_TARGET

#include <QtWidgets\QStyledItemDelegate>
#include <QtGui\QPainter>
#include <QtWidgets\QStyleOption>
#include <QtCore\QModelIndex>

#else

#include <QItemDelegate>
#include <QPainter>
#include <QStyleOption>
#include <QModelIndex>

#endif

#include "korlapadmin_model.h"
#include "ScheduleTableModel.h"

class SchedulerDelegate :
	public QStyledItemDelegate
{
	Q_OBJECT

		
public:
	void paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index)const;
	bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index);
	void setModelData ( QWidget * editor, QAbstractItemModel* model, const QModelIndex & index ) const;
	void setModel(ScheduleTableModel* m){this->tableModel = m;}
	//void paintNotSelectedSchedule(const QString &label, QPainter* painter, const QStyleOptionViewItem &option);
	void setEditorData( QWidget * editor, const QModelIndex & index ) const;
	QWidget* createEditor(QWidget* editor, const QStyleOptionViewItem & option, const QModelIndex& index)const;
	SchedulerDelegate(korlapAdmin_model * model,QObject* parent=0);
	~SchedulerDelegate(void);
private:

	Schedule* getSchedule(const QModelIndex& index)const;
	korlapAdmin_model* model;
	ScheduleTableModel* tableModel;
	int hoveredRow;
	
};
